﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JqueryNet.FormControl.FormWebControl;
using System.Web.UI.WebControls;

namespace JqueryNet.FormControl
{
    public class WebControlFactory : ControlFactory
    {
        public override IJQuery CreateIJquery(System.Web.UI.Control _control)
        {
            switch (_control.GetType().FullName)
            {
                case "System.Web.UI.WebControls.BulletedList":
                    return new JBulletedList(GetAsType<BulletedList>(_control));
                case "System.Web.UI.WebControls.Button":
                    return new JButton(GetAsType<Button>(_control));
                case "System.Web.UI.WebControls.CheckBox":
                    return new JCheckBox(GetAsType<CheckBox>(_control));
                case "System.Web.UI.WebControls.CheckBoxList":
                    return new JCheckBoxList(GetAsType<CheckBoxList>(_control));
                case "System.Web.UI.WebControls.DropDownList":
                    return new JDropDownList(GetAsType<DropDownList>(_control));
                case "System.Web.UI.WebControls.FileUpload":
                    return new JFileUpload(GetAsType<FileUpload>(_control));
                case "System.Web.UI.WebControls.HiddenField":
                    return new JHiddenField(GetAsType<HiddenField>(_control));
                case "System.Web.UI.WebControls.HyperLink":
                    return new JHyperLink(GetAsType<HyperLink>(_control));
                case "System.Web.UI.WebControls.Image":
                    return new JImage(GetAsType<Image>(_control));
                case "System.Web.UI.WebControls.ImageButton":
                    return new JImageButton(GetAsType<ImageButton>(_control));
                case "System.Web.UI.WebControls.ImageMap":
                    return new JImageMap(GetAsType<ImageMap>(_control));
                case "System.Web.UI.WebControls.Label":
                    return new JLabel(GetAsType<Label>(_control));
                case "System.Web.UI.WebControls.LinkButton":
                    return new JLinkButton(GetAsType<LinkButton>(_control));
                case "System.Web.UI.WebControls.ListBox":
                    return new JListBox(GetAsType<ListBox>(_control));
                case "System.Web.UI.WebControls.Literal":
                    return new JLiteral(GetAsType<Literal>(_control));
                case "System.Web.UI.WebControls.Panel":
                    return new JPanel(GetAsType<Panel>(_control));
                case "System.Web.UI.WebControls.RadioButton":
                    return new JRadioButton(GetAsType<RadioButton>(_control));
                case "System.Web.UI.WebControls.RadioButtonList":
                    return new JRadioButtonList(GetAsType<RadioButtonList>(_control));
                case "System.Web.UI.WebControls.TextBox":
                    return new JTextBox(GetAsType<TextBox>(_control));
                default:
                    return new JWebControl(GetAsType<WebControl>(_control));
            }
        }
    }
}
